package com.fyyg.common.llpay.config;

import com.fyyg.common.fyconst.PLATFORM;
import com.fyyg.common.util.PropertiesUtil;

import java.util.Properties;

public class LianLianConfig {
   private static Properties llProperties;
   private static String evn;
   static {
      llProperties = PropertiesUtil.getProperties("ll.properties");
   }

   public static String PAY_URL = llProperties.getProperty("PAY_URL");
   public static String QUERY_USER_BANKCARD_URL = llProperties.getProperty("QUERY_USER_BANKCARD_URL");
   public static  String QUERY_BANKCARD_URL = llProperties.getProperty("QUERY_BANKCARD_URL");
   public static String YT_PUB_KEY     = llProperties.getProperty("YT_PUB_KEY     =");
   public static String TRADER_PRI_KEY = llProperties.getProperty("TRADER_PRI_KEY");
   public static String MD5_KEY        = llProperties.getProperty("MD5_KEY");
   public static String OID_PARTNER    = llProperties.getProperty("OID_PARTNER");
   public static  String SIGN_TYPE      = llProperties.getProperty("SIGN_TYPE");
   public static String VERSION        = llProperties.getProperty("VERSION");
   public static  String BUSI_PARTNER   = llProperties.getProperty("BUSI_PARTNER");
   public static String VALID_TIME = llProperties.getProperty("VALID_TIME");

   public static String getNotifyUrl(PLATFORM platform){
      if(LianLianConfig.evn.equals("product")){
         if(platform == PLATFORM.WX){
            return  llProperties.getProperty("WX_NOTIFY_URL");
         }else if(platform == PLATFORM.PC){
            return  llProperties.getProperty("PC_NOTIFY_URL");
         }else{
            return  llProperties.getProperty("APP_NOTIFY_URL");
         }
      }else{
         if(platform == PLATFORM.WX){
            return  llProperties.getProperty("WX_TEST_NOTIFY_URL");
         }else if(platform == PLATFORM.PC){
            return  llProperties.getProperty("PC_TEST_NOTIFY_URL");
         }else{
            return  llProperties.getProperty("APP_TEST_NOTIFY_URL");
         }
      }
   }

   public static String getReturnUrl(PLATFORM platform){
      if(LianLianConfig.evn.equals("product")){
         if(platform == PLATFORM.WX){
            return  llProperties.getProperty("WX_URL_RETURN");
         }else if(platform == PLATFORM.PC){
            return  llProperties.getProperty("PC_URL_RETURN");
         }else{
            return  llProperties.getProperty("APP_URL_RETURN");
         }
      }else{
         if(platform == PLATFORM.WX){
            return  llProperties.getProperty("WX_TEST_URL_RETURN");
         }else if(platform == PLATFORM.PC){
            return  llProperties.getProperty("PC_TEST_URL_RETURN");
         }else{
            return  llProperties.getProperty("APP_TEST_URL_RETURN");
         }
      }
   }


   public void setEvn(String evn) {
      LianLianConfig.evn = evn;
   }
}
